import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElevatorTiringForm, ElevatorTiringQuery, ElevatorTiringVO } from '@/api/iot/elevatorTiring/types';

/**
 * 查询电梯困人管理列表
 * @param query
 * @returns {*}
 */

export const listElevatorTiring = (query?: ElevatorTiringQuery): AxiosPromise<ElevatorTiringVO[]> => {
  return request({
    url: '/iot/elevatorTiring/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯困人管理详细
 * @param tiringId
 */
export const getElevatorTiring = (tiringId: string | number): AxiosPromise<ElevatorTiringVO> => {
  return request({
    url: '/iot/elevatorTiring/' + tiringId,
    method: 'get'
  });
};

/**
 * 新增电梯困人管理
 * @param data
 */
export const addElevatorTiring = (data: ElevatorTiringForm) => {
  return request({
    url: '/iot/elevatorTiring',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯困人管理
 * @param data
 */
export const updateElevatorTiring = (data: ElevatorTiringForm) => {
  return request({
    url: '/iot/elevatorTiring',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯困人管理
 * @param tiringId
 */
export const delElevatorTiring = (tiringId: string | number | Array<string | number>) => {
  return request({
    url: '/iot/elevatorTiring/' + tiringId,
    method: 'delete'
  });
};
